package com.xpu.stock.mapper;

import com.xpu.stock.common.domain.InnerMarketDomain;
import com.xpu.stock.pojo.StockMarketIndexInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @author 谢丽华
 * @description 针对表【stock_market_index_info(股票大盘数据详情表)】的数据库操作Mapper
 * @createDate 2022-08-01 22:55:22
 * @Entity com.xpu.stock.pojo.StockMarketIndexInfo
 */
@Mapper
public interface StockMarketIndexInfoMapper {

    int deleteByPrimaryKey(Long id);

    int insert(StockMarketIndexInfo record);

    int insertSelective(StockMarketIndexInfo record);

    StockMarketIndexInfo selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(StockMarketIndexInfo record);

    int updateByPrimaryKey(StockMarketIndexInfo record);

    /**
     * 根据大盘id和时间查询大盘信息
     *
     * @param marketIds
     * @param timePoint
     * @return
     */
    List<InnerMarketDomain> getMarketInfo(@Param("marketIds") List<String> marketIds, @Param("timePoint") Date timePoint);

    /**
     * 根据时间范围和指定大盘id统计每分钟的交易量
     * @param marketIds 大盘id集合
     * @param startTime 开始时间
     * @param endTime 结束时间
     * @return
     */
    //作注解让它跟我们mapper中的参数做映射
    List<Map> getStockTradeVol(@Param("marketIds") List<String> marketIds, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    /**
     * 批量保存大盘数据集合
     * @param infos
     */
    void insetBatch(@Param("stockMarketInfoList") List<StockMarketIndexInfo> infos);
}
